package com.ning.weixin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ning.weixin.service.AcApiService;

/**
 * @author MENG_LI_DONG
 * @version 2018年12月18日 下午9:41:16
 */
@RequestMapping("/njxs/api")
@RestController
public class AcApiController {
	public static final String SUCCESS_CODE = "0";
	public static final String FAIL_CODE = "1";
	public static final String AUTH_CODE = "-1";
	@Autowired
	private AcApiService acApiService;
	@RequestMapping("punchActivity")
	public AcApiResponse punchActivity(@RequestParam("openid")String openid,@RequestParam("location")String location){
		return acApiService.punchActivity(openid, location);
	}
	@RequestMapping("getUserInfo")
	public AcApiResponse getUserInfo(@RequestParam("openid")String openid){
		return acApiService.getUserInfo(openid);
	}
//	@RequestMapping("shareCallback")
//	public AcApiResponse shareCallback(String openid,String location){
//		return acApiService.shareCallback(openid, location);
//	}
	@RequestMapping("getRanks")
	public AcApiResponsePage getRanks(@RequestParam("openid")String openid,@RequestParam("pageIndex")Integer pageIndex, @RequestParam("pageSize")Integer pageSize){
		return acApiService.getRanks(openid, pageIndex, pageSize);
	}
	@RequestMapping("saveContact")
	public AcApiResponse saveContact(@RequestParam("openid")String openid,@RequestParam("realname")String realname, @RequestParam("phone")String phone){
		return acApiService.saveContact(openid, realname, phone);
	}
	@RequestMapping("createQrcode")
	public AcApiResponse createQrcode(@RequestParam("locNo")String locNo, @RequestParam("deviceNo")String deviceNo){
		return acApiService.createQrcode(locNo, deviceNo);
	}
	@RequestMapping("getQrcode")
	public AcApiResponse getQrcode(@RequestParam("id ")String id) {
		return acApiService.getQrcode(id);
	}
//	@RequestMapping("test")
//	public AcApiResponse test(){
//		AcWechatInfo t = new AcWechatInfo();
//		t.setCity("city");
//		t.setCountry("country");
//		t.setCreateTime(new Date());
//		t.setHeadimgurl("headimgurl");
//		t.setNickname("nickname");
//		t.setOpenid("openid");
//		t.setProvince("province");
//		t.setSex(1);
//		t.setUpdateTime(t.getCreateTime());
//		acApiService.saveWechatInfo(t);
//		return null;
//	}

}
